package com.huawei;

import java.util.Scanner;

public class HJ005 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String hexStr = scanner.nextLine();
        //TODO 别面向API写算法，有空造一个轮子
        int decimal = Integer.parseInt(hexStr.substring(2), 16);
        System.out.println(decimal);
    }
}
